package xyz.mumuwei.youthcourseserver.service;

import com.baomidou.mybatisplus.extension.service.IService;
import org.springframework.web.multipart.MultipartFile;
import xyz.mumuwei.youthcourseserver.common.lang.Result;
import xyz.mumuwei.youthcourseserver.pojo.FileResources;

import java.io.IOException;
import java.security.NoSuchAlgorithmException;

/**
 * @author mumuwei
 * @since 2022-02-19
 */
public interface FileService extends IService<FileResources> {

    /**
     * 上传用户账户头像
     * @param file 头像文件
     * @param uid 用户id
     * @return 头像文件名
     * @throws NoSuchAlgorithmException 异常
     * @throws IOException IO操作异常
     */
    Result uploadAvatar(MultipartFile file, Integer uid) throws NoSuchAlgorithmException, IOException;

    /**
     * 上传文件处理
     * @param file 上传的文件
     * @return 返回操作结果
     * @throws IOException IO操作异常
     * @throws NoSuchAlgorithmException 异常
     */
    Result uploadFile(MultipartFile file) throws IOException, NoSuchAlgorithmException;
}
